//
//  CAlayer+Add.m
//  xunjiefanyiruanjian
//
//  Created by 陈镇 on 2024/8/7.
//

#import "UIView+Add.h"

@implementation UIView (Add)
-(void)sl_cornerRadius:(CGFloat)radius{
    self.layer.cornerRadius = radius;
    self.layer.masksToBounds = YES;
}
-(void)sl_cornerTopRadius:(CGFloat)radius{

    self.layer.maskedCorners = kCALayerMinXMinYCorner | kCALayerMaxXMinYCorner;
    self.layer.masksToBounds = YES;
    self.layer.cornerRadius = radius;
}
-(void)sl_cornerBotttomRadius:(CGFloat)radius{
    self.layer.maskedCorners = kCALayerMinXMaxYCorner | kCALayerMaxXMaxYCorner;
    self.layer.masksToBounds = YES;
    self.layer.cornerRadius = radius;
    
}
-(void)sl_cornerLeftRadius:(CGFloat)radius{

    self.layer.maskedCorners = kCALayerMinXMinYCorner | kCALayerMinXMaxYCorner;
    self.layer.masksToBounds = YES;
    self.layer.cornerRadius = radius;
}
-(void)sl_cornerRightRadius:(CGFloat)radius{
    self.layer.maskedCorners = kCALayerMaxXMinYCorner | kCALayerMaxXMaxYCorner;
    self.layer.masksToBounds = YES;
    self.layer.cornerRadius = radius;
    
}

-(void)sl_cornerOppositeAnglesRadius:(CGFloat)radius isLeft:(BOOL)isLeft{
    if (isLeft) {
        self.layer.maskedCorners = kCALayerMinXMinYCorner | kCALayerMaxXMaxYCorner;
    }else{
        self.layer.maskedCorners = kCALayerMaxXMinYCorner | kCALayerMinXMaxYCorner;
    }

    self.layer.masksToBounds = YES;
    self.layer.cornerRadius = radius;
}

-(void)sl_borderColor:(UIColor *)color borderWidth:(CGFloat)width{
    self.layer.borderColor = color.CGColor;
    self.layer.borderWidth = width;
}
@end
